KFbxGeometryBase Class Reference

#include <kfbxgeometrybase.h>
Inheritance diagram for KFbxGeometryBase:
Inheritance graph
[legend]

List of all members.


Detailed Description

This class is the base class for geometric object such as meshes, NURBS and patches.

Use the KFbxGeometryBase class to manage the control points, normals, binormals and tangents of the geometries. The meaning of "control point" is dependant of the geometry object type. For meshes, the "control point" is the physical 3D coordinate of polygon vertices while, for NURBS, it is the the actual control point on the curves defining the surface. This class also allow you to define normals, binormals and tangents regardless of the type of geometric object. However, in reality, applying such definitions to NURBS and patches does not make much sense since these definitions would only exist at the control points and inbetween them, the interpolation would certainly not follow the curve.

Geometric objects are using a system of layered data to extend their construction definition. For example, a typical layer for a Mesh contains Normals, UVs and Materials but client applications can decide to define another set of Normals and UVs and swap them during the rendering phase to produce some different results. The combinations are limitless and it would be impossible to discuss them all. This example has been presented to show one possible context where layers can be used. More information can be found in the KFbxLayerContainer and KFbxLayer classes description.

Definition at line 70 of file kfbxgeometrybase.h.


Public and fast access Properties

KFbxTypedProperty< fbxDouble3 BBoxMin
  The minimum value of the control points bounding box.
KFbxTypedProperty< fbxDouble3 BBoxMax
  The maximum value of the control points bounding box.
void  ComputeBBox ()
  Computes the control points Bounding box.

Control Points, Normals, Binormals and Tangent Management.

virtual void  InitControlPoints (int pCount)
  Allocates memory space for the array of control points.
void  InitNormals (int pCount=0)
  Allocates memory space for the array of normals.
void  InitNormals (KFbxGeometryBase *pSrc)
  Allocates memory space for the array of normals cloned from the pSrc.
void  InitTangents (int pCount=0, const int pLayerIndex=0, const char *pName="")
  Allocates memory space for the array of tangents on specified layer.
void  InitTangents (KFbxGeometryBase *pSrc, const int pLayerIndex=0)
  Allocates memory space for the array of tangents cloned from the pSrc on the specified layer.
void  InitBinormals (int pCount=0, const int pLayerIndex=0, const char *pName="")
  Allocates memory space for the array of binormals.
void  InitBinormals (KFbxGeometryBase *pSrc, const int pLayerIndex=0)
  Allocates memory space for the array of binormals cloned from the pSrc.
virtual void  SetControlPointAt (const KFbxVector4 &pCtrlPoint, const KFbxVector4 &pNormal, int pIndex, bool pI2DSearch=false)
  Sets the control point and the normal values at the specified index.
virtual void  SetControlPointAt (const KFbxVector4 &pCtrlPoint, int pIndex)
  Sets the control point at a specified index.
virtual KFbxVector4  GetControlPointAt (int pIndex) const
  Gets the control point at the specified index.
virtual void  SetControlPointNormalAt (const KFbxVector4 &pNormal, int pIndex, bool pI2DSearch=false)
  Sets the control point normal value at the specified index.
virtual int  GetControlPointsCount () const
  Returns the number of control points.
virtual KFbxVector4 GetControlPoints () const
  Returns a pointer to the array of control points.
virtual void  SetControlPointCount (int pCount)
  Allocates memory space for the array of control points.

Off-loading Serialization section

The methods in this section are typically called by a peripheral ( KFbxPeripheral).

There should be no real interest in calling them directly. The functions will write/read the memory dump of the data contained in this class. Each data block written/read will start with an (int) value representing the number of items in the array. If this value (v) is not zero, it will be followed by the array content. A block of data that is (v * sizeof(array item size)) bytes big. The methods will also call the parent class ones to dump the Layers content.

virtual bool  ContentWriteTo (KFbxStream &pStream) const
  Writes the content of the geometry object to the specified stream.
virtual bool  ContentReadFrom (const KFbxStream &pStream)
  Reads the content of the geometry object from the specified stream.

Public Member Functions

virtual int  MemoryUsage () const
  Calculate the actual amount of memory used by this geometry object.

Member Function Documentation

virtual void InitControlPoints ( int  pCount  )  [virtual]

Allocates memory space for the array of control points.

Parameters:
pCount  The number of control points.
Remarks:
Any previously allocated array of control points will be cleared.

void InitNormals ( int  pCount = 0  ) 

Allocates memory space for the array of normals.

Parameters:
pCount  The desired size for the normal array. If pCount is specified, the array will be the same size as pCount. If pCount is not specified, the array will be the same length as the array of control points.
Remarks:
This function must be called after function KFbxLayerContainer::InitControlPoints().

The normals initialized with this function will have the ReferenceMode set to eDIRECT. Also, the array will always be defined on layer 0.

void InitNormals ( KFbxGeometryBase pSrc  ) 

Allocates memory space for the array of normals cloned from the pSrc.

Parameters:
pSrc  The source geometry from which the normals information is cloned.
Remarks:
This function must be called with the argument, otherwise it does not do anything. Also, it will only process the normals array defined on layer 0 of the pSrc.

void InitTangents ( int  pCount = 0,
const int  pLayerIndex = 0,
const char *  pName = ""  
)

Allocates memory space for the array of tangents on specified layer.

Parameters:
pCount  The desired size of the tangent array. If pCount is specified, the array will be the same size as pCount. If pCount is not specified, the array will be the same length as the array of control points.
pLayerIndex  The specified layer index to allocate memory space for the array of tangents.
pName  The specified name for the allocated tangents array.
Remarks:
This function must be called after function KFbxLayerContainer::InitControlPoints(). The tangents initialized with this function will have the reference mode set to eDIRECT.

void InitTangents ( KFbxGeometryBase pSrc,
const int  pLayerIndex = 0  
)

Allocates memory space for the array of tangents cloned from the pSrc on the specified layer.

Parameters:
pSrc  The source geometry from which the tangents information is cloned.
pLayerIndex  The specified layer index to allocate memory space for cloned array of tangents from the pSrc.
Remarks:
This function must be called with the argument, otherwise it does not do anything.

void InitBinormals ( int  pCount = 0,
const int  pLayerIndex = 0,
const char *  pName = ""  
)

Allocates memory space for the array of binormals.

Parameters:
pCount  The desired size of the binormal array. If pCount is specified, the array will have the same size as pCount. If pCount is not specified, the array will be the same length as the array of control points.
pLayerIndex  The specified layer index to allocate memory space for the array of binormals.
pName  The specified name for the allocated binormals array.
Remarks:
This function must be called after function KFbxLayerContainer::InitControlPoints(). The binormals initialized with this function will have the reference mode set to eDIRECT.

void InitBinormals ( KFbxGeometryBase pSrc,
const int  pLayerIndex = 0  
)

Allocates memory space for the array of binormals cloned from the pSrc.

Parameters:
pSrc  The source geometry from which the binormals information is cloned.
pLayerIndex  The specified layer index to allocate memory space for cloned array of binormals from the pSrc.
Remarks:
This function must be called with the argument, otherwise it does not do anything.

virtual void SetControlPointAt ( const KFbxVector4 pCtrlPoint,
const KFbxVector4 pNormal,
int  pIndex,
bool  pI2DSearch = false  
) [virtual]

Sets the control point and the normal values at the specified index.

Parameters:
pCtrlPoint  The value of the control point.
pNormal  The value of the normal.
pIndex  The specified index of the control point/normal.
pI2DSearch  When true AND the normals array reference mode is eINDEX_TO_DIRECT, search pNormal in the existing array to avoid inserting if it already exist. NOTE: This feature uses a linear search algorithm, therefore it can be time consuming if the DIRECT array of normals contains a huge number of elements.
Remarks:
If the arrays (control points and normals) are not big enough to store the values at the specified index, they will be automatically resized to accomodate the new entries.

virtual void SetControlPointAt ( const KFbxVector4 pCtrlPoint,
int  pIndex  
) [virtual]

Sets the control point at a specified index.

Parameters:
pCtrlPoint  The value of the control point.
pIndex  The specified index of the control point.
Remarks:
If the array is not big enough to store the value at the specified index, it will be automatically resized to accomodate the new entry.

virtual KFbxVector4 GetControlPointAt ( int  pIndex  )  const [virtual]

Gets the control point at the specified index.

Parameters:
pIndex  The specified index of the control point.
Returns:
The value of the specific control point.
Remarks:
If index is out of range, KFbxVector4(0, 0, 0) is returned.

virtual void SetControlPointNormalAt ( const KFbxVector4 pNormal,
int  pIndex,
bool  pI2DSearch = false  
) [virtual]

Sets the control point normal value at the specified index.

Parameters:
pNormal  The value of the normal.
pIndex  The specified index of the normal.
pI2DSearch  When true AND the normals array reference mode is eINDEX_TO_DIRECT, search pNormal in the existing array to avoid inserting it if it already exist. NOTE: this feature uses a linear search algorithm, therefore it can be time consuming if the DIRECT array of normals contains a huge number of elements.
Remarks:
If the array is not big enough to store the value at the specified index, it will be automatically resized to accomodate the new entry.

virtual int GetControlPointsCount (  )  const [virtual]

Returns the number of control points.

Returns:
The number of control points allocated in the geometry.

Reimplemented in KFbxTrimNurbsSurface.

virtual KFbxVector4* GetControlPoints (  )  const [virtual]

Returns a pointer to the array of control points.

Returns:
Pointer to the array of control points, or NULL if the array has not been allocated.
Remarks:
Use the function KFbxGeometryBase::InitControlPoints() to allocate the array.

Reimplemented in KFbxTrimNurbsSurface.

virtual void SetControlPointCount ( int  pCount  )  [virtual]

Allocates memory space for the array of control points.

Parameters:
pCount  The number of control points.
Remarks:
Any previously allocated array of control points will NOT be cleared.

void ComputeBBox (  ) 

Computes the control points Bounding box.

virtual bool ContentWriteTo ( KFbxStream pStream  )  const [virtual]

Writes the content of the geometry object to the specified stream.

Parameters:
pStream  The destination stream.
Returns:
True if the content is successfully processed by the receiving stream, false otherwise.

Reimplemented from KFbxObject.

Reimplemented in KFbxPatch.

virtual bool ContentReadFrom ( const KFbxStream pStream  )  [virtual]

Reads the content of the geometry object from the specified stream.

Parameters:
pStream  The source stream.
Returns:
True if the geometry object fills itself with the received data from the stream successfully, false otherwise.

Reimplemented from KFbxObject.

Reimplemented in KFbxPatch.

virtual int MemoryUsage (  )  const [virtual]

Calculate the actual amount of memory used by this geometry object.

Returns:
The memory size in bytes (includes the amount use by the data defined in the layers).

Member Data Documentation

The minimum value of the control points bounding box.

Definition at line 205 of file kfbxgeometrybase.h.

The maximum value of the control points bounding box.

Definition at line 208 of file kfbxgeometrybase.h.

KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase
KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase KFbxGeometryBase